import axios from "axios"
export default{
    namespaced: true,
    state: {
        aaa:'',
        bbb:true
    },
    mutations: {
        DISPATCH(state,payload){
           state.aaa = prompt('请输入你的昵称')
        },
        DELS(state,payload){
             state.bbb = confirm('你确定要删除吗')
            // console.log(bbb);
        },
        
    },
    actions: {
        async FORWARD(context,payload){
            context.commit('DISPATCH')
            await axios.post('http://chst.vip:1902/students/addlist',{
                content:payload,
                name:context.state.aaa
            })
            context.dispatch('message/GETMSG',payload,{root:true})
        },
        async DEL(context,payload,a){
            context.commit('DELS')
            let ddd = context.state.bbb
            if(ddd){
                await axios.get('http://chst.vip:1902/students/del',{
                    params:{id:payload.id}
                })
                context.dispatch('message/GETMSG',a,{root:true})
            }
            
        }
    },
    getters: {
        
    }

}